import java.util.Scanner;

public class Test3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("输入一个正数：");
        int n = scanner.nextInt();
        System.out.println("该数的阶层和是：" + sumFactorial(n));
    }

    public static int sumFactorial(int n){
        int num = 1;
        int sum = 0;
        for (int i = 1; i <= n; i++) {
            num *= i;
            sum += num;
        }
        return sum;
    }
}


